import i18nVue from "@/locale";
const i18n  = i18nVue.global;
export function formatConversationCardMessage(messageItem) {
  let content = messageItem.content;
  let contentType = getConversationCardContentType(messageItem);
  content = getContent(content, contentType, messageItem);
  return content;
}
export function getConversationCardContentType(messageItem) {
  return messageItem.contentType || 110;
}
function getContent(c, cType, latestMsg) {
  let content = c;
  switch (cType) {
    case 101: //文字
      break;
    case 102:
      content = i18n.t('notice.format-message.28l7oa');
      break;
    case 103:
      content = i18n.t('notice.format-message.68pvf9');
      break;
    case 104:
      content = i18n.t('notice.format-message.epz68w');
      break;
    case 105:
      content = i18n.t('notice.format-message.74q57i');
      break;
    case 106:
      content = JSON.parse(content).text;
      break;
    case 107: //合并消息
      content = JSON.parse(content).title;
      break;
    case 108:
      content = i18n.t('notice.format-message.e64g3l');
      break;
    case 109:
      content = i18n.t('notice.format-message.6hm5b6');
      break;
    case 110:
      content = i18n.t('notice.format-message.44zq32');
      break;
    case 111:
      content = latestMsg.senderNickname + i18n.t('notice.format-message.t6sw68');
      break;
    case 114:
      content = JSON.parse(content).text;
      break;
    case 115:
      content = i18n.t('notice.format-message.ltcik3');
      break;
    case 118:
      content = latestMsg.senderNickname + i18n.t('notice.format-message.t6sw68');
      break;
    case 1204:
      content = i18n.t('notice.format-message.b91ufb');
      break;
    default:
      try {
        let c2 = JSON.parse(content);
        console.log(c2, cType);
      } catch (error) {
        console.log(error);
      }
      // let c3 = JSON.parse(c2.jsonDetail);
      // console.log(cType, c2.defaultTips, c3);
      content = i18n.t('notice.format-message.i23yq9');
      break;
  }
  return content;
}